{template 'public/header'}

{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/zh_tcwq/template/public/ygcss.css">
<style type="text/css">
    input[type="radio"] + label::before {
        content: "\a0"; /*不换行空格*/
        display: inline-block;
        vertical-align: middle;
        font-size: 16px;
        width: 1em;
        height: 1em;
        margin-right: .4em;
        border-radius: 50%;
        border: 2px solid #ddd;
        text-indent: .15em;
        line-height: 1; 
    }
    input[type="radio"]:checked + label::before {
        background-color: #44ABF7;
        background-clip: content-box;
        padding: .1em;
        border: 2px solid #44ABF7;
    }
    input[type="radio"] {
        position: absolute;
        clip: rect(0, 0, 0, 0);
    }
     .dizhi{margin-top: 10px;color: #44ABF7;}
      .ygmargin{margin-top: 10px;color: #999;}
</style>

<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>    
    <li ><a href="{php echo $this->createWebUrl2('dlinactivity')}">活动管理</a></li>
    <li class="active"><a href="{php echo $this->createWebUrl2('dlinaddactivity')}">添加活动</a></li>
</ul>

<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <div class="panel panel-default ygdefault">
            <div class="panel-heading wyheader">
                活动信息
            </div>
            <div class="panel-body">
                 <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label" style="margin-right: 15px;">活动分类</label>
                    <select class="col-sm-8" name="type_id" id="onefenlei">
                        {loop $type $key $item}
                        {if $info['type_id']==$item['id']}
                        <option value="{$item['id']}" selected="selected">{$item['type_name']}</option>
                        {else}
                        <option value="{$item['id']}">{$item['type_name']}</option>
                        {/if}
                        {/loop}
                    </select>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动标题</label>
                    <div class="col-sm-9">
                        <input type="text" name="title" class="form-control" value="{$info['title']}" />
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动logo</label>
                    <div class="col-sm-9">
                       {php echo tpl_form_field_image('logo',$info['logo']);}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动轮播图</label>
                    <div class="col-sm-9">
                       {php echo tpl_form_field_multi_image('img',$img);}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">限制人数</label>
                    <div class="col-sm-9">
                        <input type="number" name="number" class="form-control" value="{$info['number']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动价格</label>
                    <div class="col-sm-9">
                        <input type="text" onkeyup="value=value.replace(/[^\d.]/g,'')" name="money" class="form-control" value="{$info['money']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
                    <div class="col-sm-9">
                    <input type="number" name="view" class="form-control" value="{$info['view']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">浏览量</label>
                    <div class="col-sm-9">
                    <input type="number" name="num" class="form-control" value="{$info['num']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">联系电话</label>
                    <div class="col-sm-9">
                        <input type="text" name="tel" class="form-control" value="{$info['tel']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">地址信息</label>
                    <div class="col-sm-9">
                        <input type="text" name="address" class="form-control" value="{$info['address']}" />
                    </div>
                </div>
                   <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">地址坐标</label>
                    <div class="col-sm-10">
                     <!-- {php echo tpl_form_field_coordinate('op',$list['coordinate'])} -->
                     <input type="text" name="coordinate" class="form-control dizhiname" value="{$info['coordinate']}" placeholder="例如:30.527540,114.346430" />
                     <a href="http://lbs.qq.com/tool/getpoint/" target="_blank">
                     <p class="dizhi">*点击获取地理位置</p></a>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">开始时间</label>
                    <div class="col-sm-10">
                       {php echo tpl_form_field_date('start_time',$info['start_time'],$withtime = true)}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">结束时间</label>
                    <div class="col-sm-10">
                       {php echo tpl_form_field_date('end_time',$info['end_time'],$withtime = true)}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动详情</label>
                    <div class="col-sm-10">
                    {php echo tpl_ueditor('details',$info['details']);}
                    </div>
                </div>
                
<!--                 <div class="form-group">
    <label class="col-xs-12 col-sm-3 col-md-2 control-label">所属城市</label>
    <div class="col-sm-9">
        <input type="text" name="cityname" class="form-control" value="{$info['cityname']}" />
        <div class="ygmargin">*例如:武汉市,不填则为全国版</div>
    </div>

</div> -->
         
                 <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">报名通道
                        <span class="timeygbox"></span>
                    </label>
                    <div class="col-sm-9">
                        <label class="radio-inline">
                            <input type="radio" id="emailwy3" name="is_bm" value="1" {if $info['is_bm']==1 || empty($info['is_bm'])}checked{/if} />
                            <label for="emailwy3">开启</label>
                        </label>
                        <label class="radio-inline">
                            <input type="radio" id="emailwy4" name="is_bm" value="2" {if $info['is_bm']==2}checked{/if} />
                            <label for="emailwy4">关闭</label>
                        </label>
                        <div class="ygmargin">*开启后小程序端用户可以报名此活动,关闭后则无法报名此活动</div>
                    </div>

                </div>   
              
           

            </div>

        </div>

        <div class="form-group">

            <input type="submit" name="submit" value="提交" class="btn col-lg-3" style="color: white;background-color: #44ABF7;"/>

            <input type="hidden" name="token" value="{$_W['token']}" />
             <input type="hidden" name="id" value="{$info['id']}" />

        </div>

    </form>

</div>
<script type="text/javascript">
	$(function(){
        $("#frame-20").show();
        $("#yframe-20").addClass("wyactive");
        
		var onefen = $("#onefenlei").val();
        console.log(onefen)
		$.ajax({
            type:"post",
            url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=GetInformationType&m=zh_tcwq",
            dataType:"text",
            data:{id:onefen},
            success:function(data){
            	var data = eval('(' + data + ')');
                console.log(data);
                for(var i = 0; i<data.length;i++){
                	console.log(data[i].name+data[i].id);
                	$("#twofenlei").append("<option value="+data[i].id+">"+data[i].name+"</option>");                    	
                }
                console.log("这是选中的值："+$("#twofenlei").val());
                $("#twofenlei").val($("#hiddeninfo").val());
                
            }
        })
		$("#onefenlei").change(function(){
			$("#twofenlei").empty();
			var str = $("#onefenlei option").map(function(){
				return $(this).text();
			}).get().join(", ")
			console.log(str);
			var onefenl = $("#onefenlei").val();
			var twofen = $("#twofenlei").val();
			$.ajax({
                type:"post",
                url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=GetInformationType&m=zh_tcwq",
                dataType:"text",
                data:{id:onefenl},
                success:function(data){
                	var data = eval('(' + data + ')');
                    console.log(data);
                    for(var i = 0; i<data.length;i++){
                    	console.log(data[i].name+data[i].id);
                    	$("#twofenlei").append("<option value="+data[i].id+">"+data[i].name+"</option>");                    	
                    }
                    console.log("这是选中的值："+$("#twofenlei").val());
                }
            })
			
			
		});

	})
</script>
{template 'common/footer'}